//
//  BaseTableViewController.m
//  OASystem
//
//  Created by zhoupengfei on 15/11/15.
//  Copyright © 2015年 zpf. All rights reserved.
//

#import "BaseTableViewController.h"
#import "Toast+UIView.h"
@interface BaseTableViewController ()

@end

@implementation BaseTableViewController

-(NSMutableArray*)contentsArray{

    if (_contentsArray == nil) {
        _contentsArray = [NSMutableArray array];
    }
    
    return _contentsArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    __weak typeof(self) weakSelf = self;
    if (self.isNeedRefresh) {
        [self.tableView addHeaderWithCallback:^{
            [weakSelf requestData];
        }];
        
        [self.tableView addFooterWithCallback:^{
            if ((self.currentPage - 1)*KPageSize < self.totalNumber) {
                 [weakSelf requestMoreData];
            }else{
                [weakSelf.view.window makeToast:@"没有更多数据了"];
                [weakSelf.tableView footerEndRefreshing];
            }
           
        }];
    }
}
//请求数据
-(void)requestData{

    
}
//加载更多
-(void)requestMoreData{

    
    
}

-(void)refreshData{
    self.currentPage = 1;
    [self requestData];
}

@end
